package com.huifaapp.mall.selectImage;

import android.content.Intent;
import android.support.v4.view.ViewPager;

import com.huifaapp.mall.R;
import com.huifaapp.mall.activity.BaseActivity;

import java.util.List;

public class ImageGalleryActivity extends BaseActivity {
    public static final String EXTRA_IMAGES = "images";
    public static final String EXTRA_CAN_OPERAT = "can_operate";
    public static final String EXTRA_POSITION = "EXTRA_POSITION";

    private List<String> mImageList;

    private ViewPager mViewPager;
    private GalleryAdapter mPagerAdapter;
    private boolean isCanOperate;
    private int position;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_image_gallery;
    }

    @Override
    protected void initView() {
        mViewPager = (ViewPager) findViewById(R.id.view_pager);
        mPagerAdapter = new GalleryAdapter(this, mImageList);
        mViewPager.setAdapter(mPagerAdapter);
        mViewPager.setCurrentItem(position);
    }

    @Override
    protected void initialize() {
        Intent intent = getIntent();
        mImageList = intent.getStringArrayListExtra(EXTRA_IMAGES);
        isCanOperate = intent.getBooleanExtra(EXTRA_CAN_OPERAT, true);
        position = intent.getIntExtra(EXTRA_POSITION, 0);
    }
}
